function quickLeakedRelease(release_id)
{
    var gt = new Gettext({ domain : 'musdb', locale_data : json_locale_data});

    var rr = document.getElementById('quick_leaked');
    var button = document.getElementById('qleaked_button');
    if(rr)
        button.disabled=true;

    $.ajax({
            url: '/?cat=add_leak',
            data: 'action=leaked&release_id=' + release_id,
            dataType: 'json',
            type: 'post',
            success: function (j) {
                    if(j.ok)
                        {
                            var r = document.getElementById('quick_leaked');
                            if(r)
                                r.outerHTML = '<div id="quick_leaked" style="float: left;"><input id="qunleaked_button" type="button" value="'+gt.gettext("Mark as not leaked")+'" onclick="quickUnleakedRelease(\''+release_id+'\'); return false;"></div>';
                        }
                    else
                        {
                            var r = document.getElementById('quick_leaked');
                            if(r)
                                r.outerHTML = '<div id="quick_leaked" style="float: left;">'+gt.gettext("Error")+'</div>';
                        }
                }
            });
}

function quickUnleakedRelease(release_id)
{
    var gt = new Gettext({ domain : 'musdb', locale_data : json_locale_data});

    var rr = document.getElementById('quick_leaked');
    var button = document.getElementById('qunleaked_button');
    if(rr)
        button.disabled=true;

    $.ajax({
            url: '/?cat=add_leak',
            data: 'action=unleaked&release_id=' + release_id,
            dataType: 'json',
            type: 'post',
            success: function (j) {
                    if(j.ok)
                        {
                            var r = document.getElementById('quick_leaked');
                            if(r)
                                r.outerHTML = '<div id="quick_leaked" style="float: left;"><input id="qleaked_button" type="button" value="'+gt.gettext("Mark as leaked")+'" onclick="quickLeakedRelease(\''+release_id+'\'); return false;"></div>';
                        }
                    else
                        {
                            var r = document.getElementById('quick_leaked');
                            if(r)
                                r.outerHTML = '<div id="quick_leaked" style="float: left;">'+gt.gettext("Error")+'</div>';
                        }
                }
            });
}